<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">

  <!-- This page contains the form for entering and editing employee data -->
  <h:head>
    <title>IGNORED</title>

    <f:metadata>
      <f:viewParam name="modId" value="#{modulbean.modId}" />
    </f:metadata>
  </h:head>
  <h:body>
    <ui:composition template="/templates/stud_layout.xhtml">
      <ui:define name="content">
        <h2>#{strings.modul_h1}</h2>
        <h:form>
          <h:panelGrid columns="2">
            <h:outputText value="#{strings.modul_id}:" rendered="#{modulbean.updating}"  />
            <h:outputText value="#{modulbean.modId}" rendered="#{modulbean.updating}" />
            <h:outputText value="#{strings.modul_navn}:" />
            <h:panelGroup>
              <h:inputText id="navn" label="#{strings.modul_navn}"
                           value="#{modulbean.navn}" required="true" />
              <h:message for="navn" />
            </h:panelGroup>

            <h:outputText value="#{strings.modul_student}:" />
            <h:selectOneMenu value="#{modulbean.student}"
                             converter="#{studconverter}">
              <f:selectItems value="#{studlistbean.studenter}" var="stud"
                             itemValue="#{stud}" itemLabel="#{stud.navn}"
                             />
            </h:selectOneMenu>
          </h:panelGrid>

          <h:commandButton value="#{strings.modul_save}"
                           action="#{modulbean.saveModul}" />
          <h:commandButton value="#{strings.modul_delete}"
                           rendered="#{modulbean.updating}"
                           action="#{modulbean.deleteModul}" />
          <h:commandButton value="#{strings.modul_cancel}" immediate="true"
                           action="moduler" />
        </h:form>
      </ui:define>
    </ui:composition>
  </h:body>
</html>